package com.winning.sjzc.zyml.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.winning.sjzc.common.entity.po.SysZcjgEntity;
import com.winning.sjzc.common.entity.vo.JgTreeEntity;
import com.winning.sjzc.zyml.dao.PsmsSjjflMapper;
import com.winning.sjzc.zyml.entity.PsmsSjjflEntity;
import com.winning.sjzc.zyml.entity.SjjflTreeEntity;
import com.winning.sjzc.zyml.service.PsmsSjjflService;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * description: 数据集分类
 *
 * @author yanxf@winning.com.cn
 * @date 2019/08/14 14:54
 */
@Service
public class PsmsSjjflServiceImpl implements PsmsSjjflService {

  @Autowired
  private PsmsSjjflMapper psmsSjjflMapper;

  @Override
  public List<PsmsSjjflEntity> findByEntity(PsmsSjjflEntity entity) {
    HashMap<String, Object> map = new HashMap<>(2);
    if (StringUtils.isNotEmpty(entity.getEjlbdm())) {
      map.put("EJLBDM", entity.getEjlbdm());
    }
    map.put("FLJB", entity.getFljb());
    return psmsSjjflMapper.selectByMap(map);
  }

  @Override
  public List<PsmsSjjflEntity> findALL() {
    return psmsSjjflMapper.selectList(null);
  }

  @Override
  public PsmsSjjflEntity selectById(String sjjfldm) {
    return psmsSjjflMapper.selectById(sjjfldm);
  }


  @Override
  public List<PsmsSjjflEntity> findBySjjfldm(String sjjfldm) {
    return psmsSjjflMapper.findBySjjfldm(sjjfldm);
  }

  @Override
  public List<PsmsSjjflEntity> findSjjflByFljb(String fljb) {
    return psmsSjjflMapper
            .selectList(new LambdaQueryWrapper<PsmsSjjflEntity>()
                        .eq(PsmsSjjflEntity::getJlzt,"0")
                        .eq(PsmsSjjflEntity::getFljb,"0"));
  }

  @Override
  public List<PsmsSjjflEntity> findSjjfl() {
    return psmsSjjflMapper
            .selectList(new LambdaQueryWrapper<PsmsSjjflEntity>()
                    .eq(PsmsSjjflEntity::getJlzt,"0"));
  }
}
